# Create your views here.
from django.contrib.auth.models import User
from market.models import BetRoom, Player, UserProfile
from django.core.mail import mail_admins, send_mail
from market import emailSettings


################################################################################################################
# send an email to the player of the betroom
# send an email to the player of the betroom
def sendEmailToPlayersOfTheBetroom( betroom, email_object, email_txt ):
        playerLists = Player.objects.filter( mainStrategy__betroom = betroom )
        # send an email to all the participants
        for p in playerLists:
                if p.userBeingThisPlayer.get_profile().sendMeEmails:
                        send_mail(email_object, email_txt, emailSettings.SITE_HOST_EMAIL, [ p.userBeingThisPlayer.email ], fail_silently=True)
        return





                

